<?php
	use Hdphp\Controller\Controller;
	use Common\Model\Cate;
	
	//注意 ，在往首页调数据的时候，其实在控制器中我们已经要把想要循环的数据格式组合好了，就等前台去循环了，一且数据格式都尽量放到控制器中来完成
	$categoryModel=new Cate;
	$cateData=$categoryModel->where('pid=0')->get();
	
	foreach($cateData as $k=>$v){
		$cateData[$k]['twomenu']=$categoryModel->where("pid={$v['cid']}")->get();
		$cateData[$k]['two_three']=$categoryModel->where("pid={$v['cid']}")->limit(3)->get();
	}
	
	
	
	foreach($cateData as $k=>$v){
		foreach($v['twomenu'] as $kk=>$vv) {
			$cateData[$k]['twomenu'][$kk]['threemenu']=$categoryModel->where("pid={$vv['cid']}")->get();
		}
	}		
?>


<head>
		<meta charset="UTF-8">
		<title>华为商城</title>
		<link rel="stylesheet" type="text/css" href="Public/Home/css/index.css"/>	
		<script src="Public/Home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="Public/Home/js/adTop.js" type="text/javascript" charset="utf-8"></script>
		<script src="Public/Home/js/table.js" type="text/javascript" charset="utf-8"></script>
		<script src="Public/Home/js/lbt.js" type="text/javascript" charset="utf-8"></script>
		<script src="Public/Home/js/bgImg.js" type="text/javascript" charset="utf-8"></script>
		
		
		
		<link rel="stylesheet" type="text/css" href="Public/Home/css/list.css"/>
		<link rel="shortcut icon" href="http://www.vmall.com/favicon.ico">
		<link href="Public/Home/css/ec.css" rel="stylesheet" type="text/css">		
		<!--<link rel="stylesheet" type="text/css" href="Public/Home/css/index.css"/>-->
		<!--<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>-->
		<!--<script src="Public/Home/js/adTop.js" type="text/javascript" charset="utf-8"></script>-->
		<!--<script src="Public/Home/js/table.js" type="text/javascript" charset="utf-8"></script>-->

	</head>
	<body>
		<!--头部公共头部-->
		<div id="top">
			<div class="mid">
				<div class="left">
					<a href="" class="huaWe">华为官网</a>
					<a href="" class="power">荣耀官网</a>
					<div class="softUser">
						<a href="">软件应用</a>
						<i class="iconfont bot">&#xe609;</i>
						<div class="softInner">
							<a href="#">EMUI</a>
							<a href="#">应用市场</a>
							<a href="#">云服务</a>
							<a href="#">开发者联盟</a>
						</div>
					</div>
					<a href="">花粉俱乐部</a>
					<a href="">Select Region</a>
				</div>
				<div class="right">
					<div class="webNav">
						<a href="">网站导航</a>
						<i class="iconfont botRight">&#xe609;</i>
						<div class="navIn">
							<a href="#" class="helpCenter">帮助中心</a>
							<a href="#">PC软件</a>
							<a href="#">数字音乐</a>
							<a href="#">爱旅</a>
							<a href="">华为网盘</a>
						</div>
					</div>
					<a href="">注册</a>
					<a href="">登录</a>
					<a href="">手机版</a>
					<a href="">V码(优购码)</a>
					<a href="">我的订单</a>
				</div>
			</div>
		</div>
		<!--公共头部结束-->
		<!--搜索区域-->
		<div id="search">
			<!--logo-->
			<a href=""class="log"></a>
			<!--logo结束-->
			<!--搜索框-->
			<div class="find">
				<input type="text" class="textIn" placeholder="荣耀8"/>
				<input type="submit" class="sub" value="搜索"/>
				
			</div>
			<!--搜索框结束-->
			<!--热词区域-->
			<div class="hotWord">
				<span>热门搜索 :</span>
				<a href="">V8</a>
				<a href="">5A</a>
				<a href="">荣耀7</a>
				<a href="">5X</a>
				<a href="">HUAWEI</a>
				<a href="">P9</a>
				<a href="">5C</a>
				<a href="">快充</a>
			</div>
			<!--热词区域结束-->
			<!--我的商城与购物车-->
			<div class="MyCarStore">
				<!--我的商城-->
				<div class="cover">
					<div class="MyStore">
						<a href="">我的商城</a>
						<div class="StoreBot"></div>
						<div class="MyStoreIn">
							<span class="login">
								<span>你好, 请</span>
								<a href="" class="goIn">登录</a>
								<a href="" class="resiget">注册</a>
								
							</span>
							<a href="">我的订单</a>
							<a href="">待支付</a>
							<a href="">待评论</a>
							<a href="">优惠券</a>
							<a href="">站内信</a>
							<a href=""></a>
						</div>
					</div>
				</div>
				
				<!--我的商城结束-->
				<!--我的购物车开始-->
				<div class="MyCar">
					<a href="" class="car">我的购物车</a>
					<div class="CarBot"></div>
					<div class="CarIn">
						<div class="Car">
						</div>
						<span>您的购物车是空的，赶紧选购吧！</span>				
						
					</div>
				</div>
				<!--我的购物车结束-->
			</div>
			<!--我的商城与购物车结束-->
			<!--二维码区域-->
			<div class="QrCode">
				<ul>
					<li class="Code CodeOne color"></li>
					<li class="Code CodeTwo "></li>
				</ul>
				
				<!--专享周三荣耀专场-->
				
				<img src="Public/Home/images/qrcode_vmall_app01.png" class="threeYear con"/>
				<img src="Public/Home/images/qrcode_vmall_wechat01.jpg" class="wexi con"/>
				
				<!--微信扫码关注我们-->
				
			</div>
		<!--二维码区域结束-->
		</div>
		<!--搜索区域结束-->
		<!--导航区域-->
		<div id="nav">
			<div id="center">
				<ul>
					<li class="all">
						<a href="">全部商品</a>
						<div class="navMenu">
							<!--第一个-->
							<?php foreach ($cateData as $v){?>
							
								<div class="navOne">
									
									<p><a href="<?php echo U('List/index',['cid'=>$v['cid']])?>"><?php echo $v['cname']?></a></p>
									
									<?php foreach ($v['two_three'] as $vv){?>
										<a href="<?php echo U('List/index',['cid'=>$vv['cid']])?>"><span><?php echo $vv['cname']?></span></a>
									<?php }?>
									
									<div class="box">
										<ul class="top">
											
											<?php foreach ($v['twomenu'] as $vvv){?>
												<p>
													<a href="<?php echo U('List/index',['cid'=>$vvv['cid']])?>"><?php echo $vvv['cname']?></a>
												</p>
											<?php }?>
											
										</ul>
										
										<div class="suggest">
											<span>推荐商品</span>
										</div>
										<ul class="bot">
											
											<?php foreach ($v['twomenu'] as $vvvv){?>
											<!--if判断中的非空判断，空判断-->
												<?php if(!empty($vvvv['threemenu'])){?>
                
													<?php foreach ($vvvv['threemenu'] as $v6){?>
														<p>
															<a href="<?php echo U('List/index',['cid'=>$vvvv['cid']])?>"><?php echo $v6['cname']?></a>
														</p>
													<?php }?>
												
               <?php }?>
											<?php }?>
											
										</ul>
									</div>
								</div>
							<!--第一个结束-->
							<?php }?>
						</div>
					</li>	
					<li><a href="">首 页</a></li>
					
					<?php foreach ($cateData as $v){?>
						<li><a href="<?php echo U('List/index',array('cid'=>$v['cid']))?>"><?php echo $v['cname']?></a></li>
					<?php }?>	
					
				</ul>
			</div>
		</div>
		<!--导航区域结束-->



